<template>
	<view class="content">
		<view class="uni-container statistics_bg">
			<view class="uni-flex uni-row" style="display: flex;flex-direction: row;justify-content: space-between;">
				<view class="text">在产产品实时信息</view>
			</view>


			<uni-table ref="table" border stripe>
				<uni-tr>
					<uni-th width="160" align="center">产品名称</uni-th>
					<uni-th width="130" align="center">图号</uni-th>
					<uni-th width="180" align="center">产品编码</uni-th>
					<uni-th width="30" align="center">毛坯理论重量(克)</uni-th>
						<uni-th width="30" align="center">铸造毛坯实际重量(克)</uni-th>
					<uni-th width="30" align="center">铸造</uni-th>
				
					<uni-th width="30" align="center">清理</uni-th>
					<uni-th width="30" align="center">热处理</uni-th>
					<uni-th width="30" align="center">抛丸</uni-th>
					<uni-th width="30" align="center">机加</uni-th>
					<uni-th width="30" align="center">清洗</uni-th>
					<uni-th width="30" align="center">终检/包装</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<uni-td align="center">{{ item.productname }}</uni-td>
					<uni-td align="center">
						<view class="name">{{ item.f_drawingno }}</view>
					</uni-td>
					<uni-td align="center">{{ item.productcode }}</uni-td>
					<uni-td align="center">{{ item.f_suttleweight }}</uni-td>
					<uni-td align="center">{{ item.avg_weight }}</uni-td>
					<!-- 铸造：1显示√，0空 -->
					<uni-td align="center">{{ item.yz === 1 ? '√' : '' }}</uni-td>

					<!-- 清理：1显示√，0空 -->
					<uni-td align="center">{{ item.ql === 1 ? '√' : '' }}</uni-td>
					<!-- 热处理：1显示√，0空 -->
					<uni-td align="center">{{ item.rcl === 1 ? '√' : '' }}</uni-td>
					<!-- 抛丸：1显示√，0空 -->
					<uni-td align="center">{{ item.pw === 1 ? '√' : '' }}</uni-td>
					<!-- 机加：1显示√，0空 -->
					<uni-td align="center">{{ item.jg === 1 ? '√' : '' }}</uni-td>
					<!-- 清洗：1显示√，0空 -->
					<uni-td align="center">{{ item.qx === 1 ? '√' : '' }}</uni-td>
					<!-- 终检/包装：1显示√，0空 -->
					<uni-td align="center">{{ item.bz === 1 ? '√' : '' }}</uni-td>
				</uni-tr>
			</uni-table>

		</view>


	</view>
</template>

<script>
	import {
		GetInProdRealTimeData
	} from '../../common/inprodrealtimedata_api.js'


	export default {
		data() {
			return {
				tableData: [],

				opts: {

				}

			}
		},
		onReady() {

			uni.setNavigationBarTitle({
				title: "在产产品实时信息"
			})
			this.loadData();
		},



		methods: {
			loadData() {
				var data = {
					dateType: "2"

				};
				GetInProdRealTimeData(data).then(res => {
					var array = [];
					for (var i = 0; i < res.length; i++) {
						var item = res[i];
						array.push(item);
					}
					this.tableData = array;
				});

			},


		},
	}
</script>

<style>
	@import url("inprodrealtimedata.css");
</style>